#include "ros/ros.h"
#include "nav_msgs/Odometry.h"

void processOdometryData(const nav_msgs::Odometry::ConstPtr& msg);


int main(int argc, char *argv[]) {
    setlocale(LC_ALL, "");
    ros::init(argc, argv, "odometry_subscriber");
    ros::NodeHandle nodeHandle;
    ros::Subscriber subscriber = nodeHandle.subscribe<nav_msgs::Odometry>("/odom", 1000, processOdometryData);
    ros::spin();

    return 0;
}


void processOdometryData(const nav_msgs::Odometry::ConstPtr& msg) {
    double velocity_linear = msg->twist.twist.linear.x;  // Linear velocity
    double velocity_angular = msg->twist.twist.angular.z; // Angular velocity
    ROS_INFO("Linear Velocity (x-axis): %.2f m/s, Angular Velocity (z-axis): %.2f rad/s", 
             velocity_linear, velocity_angular);
}
